package load.education;

import core.DispatcherPort;
import core.InPort;
import core.StdNode;
import core.TriggerPort;
import java.awt.Point;

/**
 *
 * @author Ben
 */
public class SetPosition extends StdNode{
    private DispatcherPort done = new DispatcherPort();
    private InPort x = new InPort(Integer.class);
    private InPort y = new InPort(Integer.class);
    private TriggerPort set = new TriggerPort() {
            @Override
            public void callInternal() {
                controller.StdDraw.getInstance().getTurtle().setPosition(new Point((Integer)x.getValue(),
                                                            (Integer)y.getValue()));
                done.callTargets();
            }
    };

    public SetPosition() {
        this.autoPutPorts();
    }

}